#pragma once

#ifndef EXAMPLE_AI
#define EXAMPLE_AI
#define SIMULATE_TEST false // If we are just running the battle sim
#define FAST_BATTLES false  // Sets game speed to max

// needs SIMULATE_TEST to be false if its true
#define SIMULATE_CHOOSER false// If we are choosing the best startegy

#include <BWAPI.h>
#include <BWTA.h>
#include <windows.h>
#include <vector>
#include <string>
#include "Alphabetical.h"
#include "StrategyPar.h"
#include "StarUtil.h"
#include "BattleSimulator.h"
#include "StarUtil.h"
#include "StratGen.h"
#include "StrategyGen.h"
#include "CompStrat.h"
#include "StratChooser.h"




extern bool analyzed;
extern bool analysis_just_finished;
extern bool has_detected;
extern BWTA::Region* home;
extern BWTA::Region* enemy_base;
DWORD WINAPI AnalyzeThread();

class ExampleAIModule : public BWAPI::AIModule
{
public:
  virtual void onStart();
  virtual void onEnd(bool isWinner);
  virtual void onFrame();
  virtual void onUnitDestroy(BWAPI::Unit* unit);
  void drawStatsEnemy();
  void drawStrat();
  void detectAllUnits();
  void drawStrategy();
  void doStrat();
  //not part of BWAPI::AIModule
  int drawStats(BWAPI::Player *player, int start,std::string playerName); 
  void drawBullets();
  void drawVisibilityData();
  void drawTerrainData();
  void showPlayers();
  void assignTargets();
  void getEnemyGroups(std::map<std::string, 
	  std::vector<BWAPI::Unit*>*>& enemyGroups);
  void getFriendlyGroups(std::map<std::string, 
	  std::vector<BWAPI::Unit*>*>& friendlyGroups);
  void showForces();
  bool show_bullets;
  bool show_visibility_data;
  void drawSimulation();
  
  // Gets the best startegy of all possible stratigies and runs 
  // battle with it.
  void simulateChoose();

  // controls giving attacking orders
  void specialAttack(BWAPI::Unit *attacker, BWAPI::Unit * target);
  
  void simulateBattle();
};


#endif
